package com.atguigu.rabbit.producer.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: Worker Hu
 * @CreateTime: 2024-07-23  17:05
 */
@Configuration
public class RabbitConfig3 {
    @Bean
    public Exchange topicExchange(){
        Exchange topicExchange01 = ExchangeBuilder.topicExchange("topic_exchange01")
                .durable(true)
                .build();
        return topicExchange01;
    }

    @Bean
    public Queue topicQueue01(){
        Queue topicQueue01 = QueueBuilder.durable("topic_queue01").build();
        return topicQueue01;
    }

    @Bean
    public Queue topicQueue02(){
        Queue topicQueue01 = QueueBuilder.durable("topic_queue02").build();
        return topicQueue01;
    }

    @Bean
    public Binding binding01(){
        Binding binding = BindingBuilder.bind(topicQueue01()).to(topicExchange()).with("*.orange.*").noargs();
        return binding;
    }

    @Bean
    public Binding binding02(){
        Binding binding = BindingBuilder.bind(topicQueue02()).to(topicExchange()).with("*.*.rabbit").noargs();
        return binding;
    }

    @Bean
    public Binding binding03(){
        Binding binding = BindingBuilder.bind(topicQueue02()).to(topicExchange()).with("lazy.y.#").noargs();
        return binding;
    }
}


